CREATE TABLE [dbo].[wld_filtros_reporte]
(
[nm_reporte] [dbo].[_nombre] NOT NULL,
[nm_campo] [dbo].[_nombre] NOT NULL,
[tp_filtro] [dbo].[_lista] NOT NULL,
[nu_orden] [dbo].[_cantidad] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[wld_filtros_reporte] ADD CONSTRAINT [PK_wld_filtros_reporte] PRIMARY KEY CLUSTERED  ([nm_reporte], [nm_campo], [tp_filtro]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[wld_filtros_reporte] ADD CONSTRAINT [FK_wld_filtros_reporte_wad_campos] FOREIGN KEY ([nm_campo]) REFERENCES [dbo].[wad_campos] ([nm_campo])
GO
ALTER TABLE [dbo].[wld_filtros_reporte] ADD CONSTRAINT [FK_wld_filtros_reporte_wld_campos_filtro] FOREIGN KEY ([nm_campo], [tp_filtro]) REFERENCES [dbo].[wld_campos_filtro] ([nm_campo], [tp_filtro]) ON DELETE CASCADE
GO
ALTER TABLE [dbo].[wld_filtros_reporte] ADD CONSTRAINT [FK_wld_filtros_reporte_wad_reportes] FOREIGN KEY ([nm_reporte]) REFERENCES [dbo].[wad_reportes] ([nm_reporte]) ON DELETE CASCADE ON UPDATE CASCADE
GO
EXEC sp_bindefault N'[dbo].[cero]', N'[dbo].[wld_filtros_reporte].[nu_orden]'
GO
